package com.zbd.microservices.service;

import javax.inject.Inject;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.zbd.microservices.domain.Authority;
import com.zbd.microservices.repository.AuthorityRepository;
import com.zbd.microservices.security.AuthoritiesConstants;

/**
 * 权力业务层
 * 对权力进行增加
 * @author D
 *
 */
@Service
@Transactional
public class AuthorityService {
    @Inject
    private AuthorityRepository repository;
    
    public Authority createAuthority(Authority authority){
        return repository.save(authority);
    } 
    
    public void delAuthority(Authority authority){
    	if(authority.equals(AuthoritiesConstants.ADMIN))  return ;
    	repository.delete(authority);
    }
}
